set more off
**JANUARY 29, 2025

**Stata code for creating the figures for "Selecting the "Best"? Competing Dimensions of Politician Quality in the Developing World"?
**By Ananish Chaudhuri, Vegard Ivversen, Francesca R. Jensenius, Pushkar Maitra
cap log close
cd "/Users/maitra/Dropbox (Monash Uni Enterprise)/Politicians/Selection_Paper/Replication Files"
use "/Users/maitra/Dropbox (Monash Uni Enterprise)/Politicians/Selection_Paper/Replication Files/selection_paper.dta", clear

gen byte politician_incoming = politician_status==1|politician_status==3

*Figure B1: Distribution of Reported number of sixes and Raven's test score. Citizens vs Politicians




twoway (histogram die_6 if citizen==1, fcolor(gray%50) lc(gray) percent)(histogram die_6 if politician_incoming==1, fcolor(white%50) lc(black) percent) ,  ytitle("Percent") legend(order(1 "Citizen" 2 "Politician") row(1) pos(6)) saving(Distribution_die6, replace)
graph export Distribution_die6.png, replace  
ksmirnov die_6 if politician_status~=2, by(citizen)

twoway (histogram ravensum if citizen==1, fcolor(gray%50) lc(gray) percent)(histogram ravensum if politician_incoming==1, fcolor(white%50) lc(black) percent) ,  ytitle("Percent") legend(order(1 "Citizen" 2 "Politician") row(1) pos(6)) saving(Distribution_ravensum, replace) xtitle("Number of Correct Responses Raven's Progressive Matrix Task")
graph export Distribution_ravensum.png, replace  
ksmirnov ravensum if politician_status~=2, by(citizen)

tab politician_status



**Table C1. Components of Motivation

gen trustindex = trust_1_high + trust_2_high + trust_3_high + trust_4_high

gen selfefficacyindex =  efficacy_1_high + efficacy_2_high + efficacy_3_high

gen selfesteemindex = selfesteem_1_high + selfesteem_2_high + selfesteem_3_high + selfesteem_4_high + selfesteem_5_high + selfesteem_6_high




foreach v of varlist efficacy_1_high {
	reg `v' politician_incoming if (citizen==1|politician_incoming==1), vce(cl GP)
	sum `v' if citizen==1
	scalar citizen_mean=r(mean)
	outreg2 using TableC1_JAN2025.xls, excel bdec(3) addstat("Mean Citizen", citizen_mean) replace
}

foreach v of varlist  efficacy_2_high efficacy_3_high selfesteem_2_high  selfesteem_4_high selfesteem_5_high selfesteem_6_high trust_1_high trust_2_high trust_3_high trust_4_high {
	reg `v' politician_incoming if (citizen==1|politician_incoming==1), vce(cl GP)
	sum `v' if citizen==1
	scalar citizen_mean=r(mean)
	outreg2 using TableC1_JAN2025.xls, excel bdec(3) addstat("Mean Citizen", citizen_mean) append
}


**Table C2. Robustness: wealth effect in the die-tossing task
reg die_6 politician_incoming if (citizen==1|politician_incoming==1), vce(cl GP)
outreg2 using TableC2_JAN2025.xls, excel bdec(3) ctitle("Model 1") replace

reg die_6 land_yes if (citizen==1|politician_incoming==1), vce(cl GP)
outreg2 using TableC2_JAN2025.xls, excel bdec(3) ctitle("Model 2") append

reg die_6 politician_incoming land_yes if (citizen==1|politician_incoming==1), vce(cl GP)
outreg2 using TableC2_JAN2025.xls, excel bdec(3) ctitle("Model 3") append



***Figure A2. Comparing North 24 Parganas to Other Districts of West Bengal

**Proportion Female
use RL_Census2011.dta, clear
destring District, gen(DistrictID)
destring Subdistt, gen(SubdistrictID)
destring TownVillage, gen(TownVillageID)

keep if TRU=="Rural" & SubdistrictID==0 & TownVillageID==0 & Religion=="Total" 

gen sharefemale = (TOT_F/TOT_P)

drop if DistrictID==342
replace DistrictID=326 if DistrictID==0
replace DistrictID=DistrictID-1 if DistrictID>342
twoway (bar  sharefemale DistrictID, fcolor(gs10) lcolor(black)) , xlabel(326 "All" 327 "Darjiling" 328 "Jalpaiguri" 329 "Koch Bihar" 330 "Uttar Dinajpur" 331 "Dakshin Dinajpur" 332 "Maldah" 333 "Murshidabad" 334 "Birbhum" 335 "Barddhaman" 336 "Nadia" 337 "North 24 Parganas" 338 "Hugli" 339 "Bankura" 340 "Puruliya" 341 "Haora" 342 "South 24 Parganas" 343 "Paschim Medinipur" 344 "Purba Medinipur", angle(vertical) labsize(small)) ytitle("Share of Women") ylabel(0(.1).5) legend(off) saving(ShareFemaleDistrictWB, replace) 
graph export ShareFemaleDistrictWB.png, replace  


**Proportion Hindu and Muslim
use RL_Census2011.dta, clear
destring District, gen(DistrictID)
destring Subdistt, gen(SubdistrictID)
destring TownVillage, gen(TownVillageID)

keep if TRU=="Rural" & SubdistrictID==0 & TownVillageID==0
keep State DistrictID SubdistrictID TownVillageID TRU Name Religion TOT_P 
gen ReligionID=0 if Religion=="Total"
replace ReligionID=1 if Religion=="Hindu"
replace ReligionID=2 if Religion=="Muslim"
replace ReligionID=3 if Religion=="Christian"
replace ReligionID=4 if Religion=="Sikh"
replace ReligionID=5 if Religion=="Buddhist"
replace ReligionID=6 if Religion=="Jain"
replace ReligionID=7 if Religion=="Other religions and persuasions"
replace ReligionID=8 if Religion=="Religion not stated"

reshape wide Religion TOT_P, i(DistrictID) j(ReligionID)

gen shareHindu = (TOT_P1/TOT_P0)
gen shareMuslim = (TOT_P2/TOT_P0)
gen shareOther = 1 - (shareHindu + shareMuslim)

drop if DistrictID==342
replace DistrictID=326 if DistrictID==0
replace DistrictID=DistrictID-1 if DistrictID>342

label def DistrictID 326 "All" 327 "Darjiling" 328 "Jalpaiguri" 329 "Koch Bihar" 330 "Uttar Dinajpur" 331 "Dakshin Dinajpur" 332 "Maldah" 333 "Murshidabad" 334 "Birbhum" 335 "Barddhaman" 336 "Nadia" 337 "North 24 Parganas" 338 "Hugli" 339 "Bankura" 340 "Puruliya" 341 "Haora" 342 "South 24 Parganas" 343 "Paschim Medinipur" 344 "Purba Medinipur"
label val DistrictID DistrictID

graph bar (asis) shareHindu shareMuslim shareOther, over(DistrictID, label(angle(vertical) labsize(*.7))) bar(1, color(gs4)) bar(2, color(gs12)) bar(3, color(gs8)) legend(order(1 "Share Hindu" 2 "Share Muslim" 3 "Share Other") row(1) pos(6)) stack saving(ShareHinduMuslimDistrictWB., replace)

graph export ShareHinduMuslimDistrictWB.png, replace  

**Proportion Literate
use RL_Census2011.dta, clear
destring District, gen(DistrictID)
destring Subdistt, gen(SubdistrictID)
destring TownVillage, gen(TownVillageID)

keep if TRU=="Rural" & SubdistrictID==0 & TownVillageID==0 & Religion=="Total"

gen TOT_6_ = TOT_P - P_06

gen prop_literate = ((P_LIT)/TOT_6_)
*gen prop_illliterate = ((P_ILL-P_06)/TOT_6_)


drop if DistrictID==342
replace DistrictID=326 if DistrictID==0
replace DistrictID=DistrictID-1 if DistrictID>342
twoway (bar  prop_literate DistrictID, fcolor(gs10) lcolor(black)) , xlabel(326 "All" 327 "Darjiling" 328 "Jalpaiguri" 329 "Koch Bihar" 330 "Uttar Dinajpur" 331 "Dakshin Dinajpur" 332 "Maldah" 333 "Murshidabad" 334 "Birbhum" 335 "Barddhaman" 336 "Nadia" 337 "North 24 Parganas" 338 "Hugli" 339 "Bankura" 340 "Puruliya" 341 "Haora" 342 "South 24 Parganas" 343 "Paschim Medinipur" 344 "Purba Medinipur", angle(vertical) labsize(small)) ytitle("Proportion Literate") ylabel(0(.1)1) legend(off) saving(PropLiterateDistrictWB, replace)

graph export PropLiterateDistrictWB.png, replace  




**Figure A1. Study Location

*** Obtaining data base and coordinate files 
***download data from https://gadm.org/download_country.html (gadm40_IND_shp.zip) and extracted the following files: gadm40_IND_2.shp and gadm40_IND_3.shp using these commands:
**shp2dta using gadm40_IND_2.shp, data("states_data") coor("states_coordinates") replace genid(id) 
**shp2dta using gadm40_IND_3.shp, data("inddistdb") coor("inddistcoor") replace genid(id) 

*Set the working directory to the folder where the downloaded data is saved.
*'outreg2', 'spmap', 'schemepack' and 'addstat' packages must be installed prior to running this code. 

**Left Panel. Location of West Bengal



*set scheme swift_red
use states_data.dta, clear
gen byte wb = ST_NM == "West Bengal"
spmap wb using states_coordinates.dta, id(id) ocolor(black ..) osize(thin)  point(data("cities.dta") xcoord(xcoord) ycoord(ycoord) fcolor(purple))  subtitle(India) legend(off) saving(wblocation, replace)

graph export wblocation.png, replace 

**Right Panel. Location of North 24 Parganas

use inddistdb.dta, clear
rename NAME_1 state
rename NAME_2 district 
replace state = "Ladakh" if state == "Jammu and Kashmir" & district == "Kargil"
replace state = "Ladakh" if state == "Jammu and Kashmir" & district == "Leh (Ladakh)"
gen byte N24 = district == "North 24 Parganas"
keep if state == "West Bengal"
spmap N24  using inddistcoor.dta , id(id) ocolor(black) osize(thin)  legend(off) point(data("cities.dta") xcoord(xcoord) ycoord(ycoord) fcolor(red))  subtitle(West Bengal) saving(N24location, replace)

graph export N24location.png, replace
